<%@ Application Language="C#" %>
<%@ Import Namespace="Memories" %>
<script runat="server">

    
       
    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        String url = Request.Path;
        
        
        String path = "";

        if (Request.QueryString["path"] != null ) path = Request.QueryString["path"];
       

        Settings settings = AlbumSettingsConfigSectionHandler.GetSettings(Request.Url.Host);
        
        
        // add settings to current context.
        Context.Items["Settings"] = settings;
        
        // add path to current context.
        Context.Items["Path"] = settings.UrlFormatter.Decrypt(path);

        // set culture info
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(settings.UICulture);
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(settings.UICulture);

    }
</script>
